package com.itheima.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.dto.RoleDto;
import com.itheima.entry.PageResult;
import com.itheima.entry.QueryPageBean;
import com.itheima.mapper.RoleMapper;
import com.itheima.mapper.RoleUserMapper;
import com.itheima.pojo.CheckGroupItem;
import com.itheima.pojo.Role;
import com.itheima.pojo.RoleUser;
import com.itheima.service.RoleService;
import com.itheima.service.RoleUserService;
import org.apache.dubbo.config.annotation.Service;

/**
 * @author jshstart
 * @creat 2020-11-23 9:43
 */
@Service
public class RoleUserServiceImpl extends ServiceImpl<RoleUserMapper, RoleUser> implements RoleUserService {

    @Override
    public Long[] findUserByRoleId(Long id) {
        return  this.baseMapper.findUserByRoleId(id);
    }

    @Override
    public void deleteById(Long roleId) {
        QueryWrapper<RoleUser> wrapper = new QueryWrapper<>();
        wrapper.eq("role_id",roleId);
        this.remove(wrapper);
    }
    @Override
    public void deleteRoleByUserId(Long userId) {
        QueryWrapper<RoleUser> wrapper = new QueryWrapper<>();
        wrapper.eq("user_id",userId);
        this.remove(wrapper);
    }
    @Override
    public Long[] findRoleByRoleId(Long id) {
        return  this.baseMapper.findRoleByRoleId(id);
    }

}
